<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="Bookmark" href="/favicon.ico">
<link rel="Shortcut Icon" href="/favicon.ico" />
<!--[if lt IE 9]>
<script type="text/javascript" src="/Public/lib/html5shiv.js"></script>
<script type="text/javascript" src="/Public/lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="/Public/static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="/Public/static/h-ui.admin/css/H-ui.admin.css" />
<link href="/Public/static/h-ui.admin/css/H-ui.login.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="/Public/lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="/Public/static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="/Public/static/h-ui.admin/css/style.css" />
<!--[if IE 6]>
<script type="text/javascript" src="/Public/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
</head>

<body>
    <nav class="breadcrumb">
        <i class="Hui-iconfont">&#xe67f;</i> 首页
        <span class="c-gray en">&gt;</span>
        系统设置
        <span class="c-gray en">&gt;</span>
        角色管理
        <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);"
            title="刷新">
            <i class="Hui-iconfont">&#xe68f;</i>
        </a>
    </nav>
    <div class="page-container">
        <div class="cl pd-5 bg-1 bk-gray mt-20">
            <span class="l">
                <a href="<?php echo U('Role/add');?>" class="btn btn-primary radius">
                    <i class="Hui-iconfont">&#xe600;</i> 添加角色</a>
            </span>
        </div>
        <div class="mt-20">
            <table class="table table-border table-bordered table-hover table-bg table-sort">
                <thead>
                    <tr class="text-c">
                        <th width="80">ID</th>
                        <th width="100">角色名</th>
                        <th width="130">创建时间</th>
                        <th width="70">状态</th>
                        <th width="100">操作</th>
                    </tr>
                </thead>
                <tbody>
                    <?php if(is_array($roles)): foreach($roles as $key=>$vo): ?><tr class="text-c">
                            <td><?php echo ($vo["id"]); ?></td>
                            <td>
                                <u style="cursor:pointer" class="text-primary"><?php echo ($vo["name"]); ?></u>
                            </td>

                            <td><?php echo ($vo["create_time"]); ?></td>
                            <td class="td-status">
                                <?php if($vo["status"] == 1): ?><span class="label label-success radius">已启用</span>
                                    <?php else: ?>
                                    <span class="label label-error radius">已停用</span><?php endif; ?>
                            </td>
                            <td class="td-manage">
                                <?php if($vo["status"] == 1): ?><a style="text-decoration:none" title="停用" onclick="forbidden_item(<?php echo ($vo['id']); ?>)">
                                        <i class="Hui-iconfont">&#xe631;</i>
                                    </a>
                                    <?php else: ?>
                                    <a style="text-decoration:none" title="启用" onclick="forbidden_item(<?php echo ($vo['id']); ?>)">
                                        <i class="Hui-iconfont">&#xe615;</i>
                                    </a><?php endif; ?>
                                <form id="forbidden_form_<?php echo ($vo["id"]); ?>" action="<?php echo U('Role/forbidden',array('id'=>$vo['id']));?>" method="POST" style="display: none;">
                                    <input type="text" value="<?php echo ($vo["id"]); ?>" name="id">
                                    <input type="text" value="<?php echo ($vo["status"]); ?>" name="status">
                                </form>

                                <a title="编辑权限" href="<?php echo U('Role/edit',array('id'=>$vo['id']));?>" class="ml-5" style="text-decoration:none">
                                    <i class="Hui-iconfont">&#xe6df;</i>
                                </a>
                                <a title="删除" href="javascript:;" onclick="del_item(<?php echo ($vo['id']); ?>)" class="ml-5" style="text-decoration:none">
                                    <i class="Hui-iconfont">&#xe6e2;</i>
                                    <form id="del_form_<?php echo ($vo["id"]); ?>" action="<?php echo U('Role/del',array('id'=>$vo['id']));?>" method="POST" style="display: none;">
                                        <input type="text" value="<?php echo ($vo["id"]); ?>" name="id">
                                    </form>
                                </a>
                            </td>
                        </tr><?php endforeach; endif; ?>
                </tbody>
            </table>


        </div>
        <script type="text/javascript" src="/Public/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="/Public/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="/Public/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="/Public/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript" src="/Public/lib/jquery.validation/1.14.0/additional-methods.js"></script>
<script type="text/javascript" src="/Public/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="/Public/static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="/Public/static/h-ui.admin/js/H-ui.admin.js"></script> 


</body>
<script>
    function del_item(id) {
        //询问框
        layer.confirm('确认要删除吗？', {
            btn: ['删除', '取消'] //按钮
        }, function () {
            $('#del_form_' + id).submit();
        }, function () {
            console.log('用户取消啦...');
        });
    }


    function forbidden_item(id) {
        //询问框
        layer.confirm('确认要修改吗？', {
            btn: ['修改', '取消'] //按钮
        }, function () {
            $('#forbidden_form_' + id).submit();
        }, function () {
            console.log('用户取消啦...');
        });
    }
</script>

</html>